package org.dromara.datacheck.mytest;

import java.time.LocalDate;
import java.time.temporal.TemporalAdjusters;

public class DateRangeBuilder {

    public static void main(String[] args) {
        String monthString = "11"; // 示例输入
        LocalDate startDate = buildStartDate(monthString);
        LocalDate endDate = buildEndDate(monthString);

        System.out.println("Start Date: " + startDate);
        System.out.println("End Date: " + endDate);
    }

    public static LocalDate buildStartDate(String monthString) {
        int month = Integer.parseInt(monthString);
        LocalDate now = LocalDate.now();
        int year = now.getYear();

        return LocalDate.of(year, month, 1);
    }

    public static LocalDate buildEndDate(String monthString) {
        int month = Integer.parseInt(monthString);
        LocalDate now = LocalDate.now();
        int year = now.getYear();

        return LocalDate.of(year, month, 1).with(TemporalAdjusters.lastDayOfMonth());
    }
}
